home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
- # make-depend - Output SOA-file dependencies, in make(1) format
- #
- # $Id: soa-easy.shar,v 8.2 1996/10/25 17:08:00 vixie Exp $
- # $Source: /proj/src/isc/cvs-1/bind/contrib/misc/soa-easy.shar,v $
- #
- # SYNOPSIS
- # make-depend SOA-file ...
-
-
- $prog = 'make-depend';
-
- foreach $file (@ARGV) {
- $zone_file = $file;
- $zone_file =~ s/\.SOA$/.zone/;
- @dependencies = &find_includes ($zone_file);
- @dependencies = grep (! /\.SOA$/, @dependencies);
- print ($file, " : ", join (' ', @dependencies), "\n");
- }
-
-
- #######################################################################
- # find_includes - Look for $INCLUDE-ed files
- #
- sub find_includes {
- local ($file) = shift (@_);
-
- local (@parts);
- local (@includes);
-
- if (! open (FILE, $file)) {
- warn "$prog: warning: can't open $file: $!\n";
- return ();
- }
-
- while (<FILE>) {
- s/;.*$//;
- if (/\$INCLUDE\s/) {
- @parts = split;
- if (! grep ($_ eq $parts[1], @includes)) {
- push (@includes, $parts[1]); }
- }
- }
- close (FILE);
-
- return (@includes);
- }
-